<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="物料名称">
                <a-input placeholder="请输入物料名称" v-model="queryParam.materialName"></a-input>
              </a-form-item>
            </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="物料编码">
              <a-input placeholder="请输入物料编码" v-model="queryParam.materialCode"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="客户物料编码">
              <a-input placeholder="请输入客户物料编码" v-model="queryParam.customCode"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->
    <div class="ant-alert ant-alert-info" style="margin-bottom: 16px">
      <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择
      <a style="font-weight: 600">{{ selectedRowKeys.length }}</a
      >项
      <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      <span style="float:right;">
        <a-popover title="自定义列" trigger="click" placement="leftBottom">
          <template slot="content">
            <a-checkbox-group @change="onColSettingsChange" v-model="settingColumns" :defaultValue="settingColumns">
              <a-row style="width: 400px">
                <template v-for="(item,index) in defColumns">
                  <template v-if="item.key!=='rowIndex'&& item.dataIndex!=='action'">
                      <a-col :span="12"><a-checkbox :value="item.dataIndex"><j-ellipsis :value="item.title" :length="10"></j-ellipsis></a-checkbox></a-col>
                  </template>
                </template>
              </a-row>
            </a-checkbox-group>
          </template>
          <a><a-icon type="setting" />设置</a >
        </a-popover>
      </span>
    </div>
    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="materialId"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        @change="handleTableChange">

        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical" />
          <a @click="handleDetail(record)">详情</a>
        </span>
      </a-table>
    </div>

    <tsl-pro-package-quota-modal ref="modalForm" @ok="modalFormOk"></tsl-pro-package-quota-modal>
  </a-card>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import TslProPackageQuotaModal from './modules/TslProPackageQuotaModal.vue'

  export default {
    name: 'TslProPackageQuotaList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      TslProPackageQuotaModal
    },
    data () {
      return {
        description: '包装定额设置管理页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
         
          {
            title:'客户物料编码',
            align:"center",
            dataIndex: 'customCode'
          },
          {
            title:'物料编码',
            align:"center",
            dataIndex: 'materialCode'
          },
          {
            title:'物料名称',
            align:"center",
            dataIndex: 'materialName'
          },
          {
            title:'规格型号',
            align:"center",
            dataIndex: 'noneSpec'
          },
          {
            title:'单位',
            align:"center",
            dataIndex: 'meUnit_dictText'
          },
          {
            title:'辅单位',
            align:"center",
            dataIndex: 'auUnit_dictText'
          },
          {
            title:'换算率',
            align:"center",
            dataIndex: 'coRate'
          },
          {
            title:'包装定额',
            align:"center",
            dataIndex: 'packageQuota'
          },
          {
            title:'封包定额',
            align:"center",
            dataIndex: 'envelopeQuota'
          },
          {
            title:'码垛定额',
            align:"center",
            dataIndex: 'palletizingQuota'
          },
          {
            title:'叉车定额',
            align:"center",
            dataIndex: 'forkliftQuota'
          },
          {
            title:'其他定额',
            align:"center",
            dataIndex: 'otherQuota'
          },
          {
            title:'状态',
            align:"center",
            dataIndex: 'status_dictText'
          },
          {
            title:'维护人',
            align:"center",
            dataIndex: 'updateBy_dictText'
          },
          {
            title:'维护日期',
            align:"center",
            dataIndex: 'updateTime'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: "/tslpropackagequota/tslProPackageQuota/quotaList",
          delete: "/tslpropackagequota/tslProPackageQuota/delete",
          deleteBatch: "/tslpropackagequota/tslProPackageQuota/deleteBatch",
          exportXlsUrl: "/tslpropackagequota/tslProPackageQuota/exportXls",
          importExcelUrl: "tslpropackagequota/tslProPackageQuota/importExcel",
          
        },
        dictOptions:{},
        superFieldList:[],
        settingColumns: [],
      }
    },
    created() {
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      initDictConfig(){
      },
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>